$(function(){
	
	$(".user-icon").css("top",$("input[name=username]").position().top);
	$(".pass-icon").css("top",$("input[name=password]").position().top);
	
	$("#submit").unbind().on("click",function(){
		var username = $("input[name=username]").val();
		var password = $("input[name=password]").val();
		if(isEmpty(username)&&isEmpty(password)){
			Alert("用户名和密码不能为空!");
			return false;
		} else{
			var data = {"userName":username,"passWd":password};
			$.ajax({
					type : "POST",
					async : false,
					data :data,
					url : "/LoginServlet/login.action",
					contentType : "application/x-www-form-urlencoded; charset=utf-8",
					dataType : "json",
					success : function(rtnData){
						if(!isEmpty(rtnData)&&rtnData.data.status=="success"){
							location.href = "../home/index.html";
//							location.href = "../salaryManager.html";
						} 
					}
			});
		}
	});
})